<script type="text/javascript">
	$(function(){
        $('.chk_id').change(function(){
            postItemChange(this,$(this).is(':checked')?1:0);
            checkboxChange();
        });
        $('.myall').click(function(){
            var selected = $(this).is(':checked');
            $(':checkbox').not(':disabled').each(function(index,item){
                postItemChange(item,selected?1:0);
                $(item).attr('checked',selected);
            });
            checkboxChange();
        });
        var postItemChange = function(item,isSelected){
            $.post('/member/selectstore', {'itemid':$(item).val(),'selected':isSelected}, function(data){
                if(data==-1){
                    alert('操作出错，请重新登录后再进行操作');
                    return;
                }
                $(".operating i,.warehousetop i em").text(data.count);
                $(".count em").text(parseInt(data.weight));
            }, 'json');            
        };
        var checkboxChange=function(){
            var ids = [];
            var weight = 0;
            $('.chk_id').each(function(index,item){
                if(  $(item).is(':checked')){                                    
                        ids.push($(item).val());
                        weight += parseInt($(item).attr('weight'));
                }
            });
            $("#store_ids").val(ids.join(','));
            $(".operating i,.warehousetop i em").text(ids.length);
            $(".count em").text(weight);                
        };
        
        $('#btnsubmit').click(function(){
            if($('.chk_id:checked').length==0){
                alert('请选择需要提交的商品');
                return false;
            }
            window.location = '/member/waybillcreate'
        });        

        $('.tez li').hover(function(){
            $('.tc',this).show();
        }, function(){
            $('.tc',this).hide();
        });
    $('.tez li').click(function(){return false});
        $('.wen').hover(function(){$('.tc',this).show();}, function(){$('.tc',this).hide();});
    })
    
</script>
<style>
    h2 span.problemimg{
        background: url(/admins/images/ico.png) no-repeat 0px -81px;
        padding-right: 0px;
        height: 16px;
        width: 16px;
        text-indent: -100000px;
        display: inline;
        margin-left: 10px;
    }
</style>
<div class="center">
	<div class="home">
        <div class="home_left">
            <?php echo $this->partial('member/menu.phtml',array('uCount' => $this->uCount,'menuId'=>$this->menuId,'user'=>$this->user,'account'=>$this->account)); ?>
            <?php //echo $this->render('member/menu.phtml'); ?>
        </div>
    	<div class="home_right">
            <div class="storehousetop">
            
                <div class="storehouse">
                    <div class="cloud">
                        <span>我的云仓库</span>
                    </div>
                    <div class="storehouseinfo">
                        <h1>我的云仓库</h1>
                        <div class="storehousenum">
                        	<h3>交易提醒：</h3>
                            <ul>
                                <li><a href="/member/mystore">我的库存<span>(<?php echo $this->uCount["store"];?>)</span></a></li>
                                <li><a href="/member/forecastlist">预报列表<span>(<?php echo $this->uCount["ingstore"];?>)</span></a></li>
                                <li><a href="/member/waybill">我的国际运单</a></li>
                            </ul>
                            <p><a href="http://help.uuch.com/?p=62" target="_blank"><i></i>如何使用云仓库？</a></p>
                        </div>
                    </div>
                </div>
            
                <div class="storehousenav">
                    <ul>
                        <li class="storehouseon"><a href="/member/mystore"><i class="storehouse1"></i>我的库存</a></li>
                        <li><a href="/member/storehistory"><i class="storehouse2"></i>仓库历史记录</a></li>
                        <li><a href="/member/storehome"><i class="storehouse3"></i>我的云仓库地址</a></li>
                    </ul>
                    <a class="yubaoruku" href="/member/instore"><span>预报入库</span></a>
                </div>
            </div>
            
            <div class="mywarehouse">
                <div class="warehousetop">
                    <h2>我的云库存：</h2>
                    <p>共 <?php echo $this->uCount["store"];?> 件，已选<i><em><?= $this->selected['count'] ?></em></i>件</p>                    
                </div>
            </div>
            <div class="warehouselist">
            	<table>
                	<tr>
                    	<th class="t1"><input name="" type="checkbox" value="" class="myall" /></th>
                    	<th class="t2">编号</th>
                    	<th class="t3">名称</th>
                    	<th class="t4">物品净重</th>
                    	<th class="t5"><div class="wen">
                                <span>体积重量</span>
                            	<a class="wtb" href="javascript:void(0)">疑问</a>
                                <div class="tc" style="display:none;margin-left:-100px;">
                                    <div class="jtou" style="margin-left:160px"></div>
                                    <p>根据四大国际快递公司规定，物品运送时，取物品实际重量与体积重量较大者进行结算。在集中托运时，一批货物由几件不同的货物组成，有轻抛货也有重货。其计费重量则采用整批货物的总毛重或总体积计量，按两者之中较高的一个计算。</p>
                               </div>
                            </div></th>
                    	<th class="t6">入库时间</th>
                    </tr>
                </table>
                <div class="Noinventory" <?php if(count($this->storelist)>0) echo "style='display:none;'";  ?>>
                	<div class="no_pic">
                    	库存为空
                    </div>
                    <div class="NOsm">
                        <h2>您的仓库没有任何物品！</h2>
                        <p>猜您接下来会：<a href="/member/instore/">预报入库</a></p>
                    </div>
                </div>
            	<table id="store_table">

                    <?php
                    //if($this->storelist)
                    foreach ($this->storelist as  $store){ ?>
                    <tr>
                    	<td class="t1">
                            <input class="chk_id" name="id" <?= $store->isDisabled()?'disabled="true"':'';?> <?= $store->isSelect()?'checked="true"':'' ?>  weight="<?php echo $store->weight; ?>" type="checkbox" value="<?php echo $store->id;?>"  />
                        </td>
                        <td class="t2">
                            <?= $store->barcode ?>
                        </td>
                        <td class="t3">
                        	<div class="whpic">
                                <a href="<?= $this->cdn ?><?= is_file('big'.$store->imageFile)?('/big'.$store->imageFile):($store->imageFile) ?>" target="_blank"><img src="<?= $this->cdn ?><?php echo $store->imageFile; ?>" alt="<?php echo $store->productName; ?>" /></a>
                            </div>
                            <div class="whinfo">
                                <h2><a href="<?= "/member/storedetail?storeid=".$store->Id ?>"><?= $store->RemarkName?$store->RemarkName:$store->ProductName;?></a>
                                    <?php if($store->IsProblem == 1){ ?>
                                    <span class="problemimg"  title="问题包裹">&nbsp;&nbsp;&nbsp;&nbsp;</span>
                                    <?php } ?>
                                </h2>
                                <?php if($store->CnShipFee&&$store->CnShipFee>0){ ?> <span style="color:red">国内运费：<?= $store->CnShipFee ?>元</span><?php } ?>
                                <div class="wh_comefrom">
                                    <label>包裹来源：</label><?= $store->LogisticsName?"[$store->LogisticsName]$store->Logistics":$store->Logistics ?>
                                </div>
                                <?php if($store->IsEmbargo + $store->BignessType + $store->ItemType > 0){?>
                                <div class="tez">
                                	<label>包裹特征：</label>
                                    <ul>
                                        <?php if($store->IsEmbargo){?>
                                        <li><a class="tz6" href="#">禁运</a>
                                            <div class="tc" style="display:none">
                                            	<div class="jtou"></div>
                                                <p>此物品各大快递均不接收运送，详情请咨询悠奇客服</p>
                                                
                                            </div>
                                        </li>
                                        <?php } ?>
                                        <?php if($store->BignessType &&$store->BignessType >0){?>
                                    	<li>
                                        	<a class="tz1" href="#">抛货</a> 
                                            <div class="tc" style="display:none">
                                            	<div class="jtou"></div>
                                                <p>此商品体积较大，当使用DHL、UPS、Fedex时需按体积重量结算运费。   <a href="http://help.uuch.com/?p=268" target="_blank">什么是体积重量？</a></p>
                                                <p>EMS和邮政小包按实际重量结算</p>
                                            </div>
                                        </li>
                                        <?php } ?>
                                        <?php foreach(Application_Model_StoreItem::getNames() as $key=>$value){ 
                                            if($key != 0 && ($store->ItemType & $key) == $key){
                                            ?>
                                            <li><a class="<?= $value[1]?>" href="#"><?= $value[0]?></a>
                                                <div class="tc" style="display:none">
                                                    <div class="jtou"></div>
                                                    <p><?= $value[2]?></p>
                                                </div>
                                            </li>
                                        <?php  }
                                          }
                                        ?>
                                    	
                                    </ul>
                                </div>
                                <?php } ?>
                            </div>
                        </td>
                        <td class="t4">
                        	<?php echo round($store->weight); ?>g
                            <p><?php if($store->isPack) echo '带包装'; else echo '';?></p>
                        </td>
                        <td class="t5"><?= $store->VolumeWeight?$store->VolumeWeight.'g':'(无)'; ?></td>
                        <td class="t6">
                            <?php  echo $store->dateInStore; ?>
                            <?php
                                $ad = Application_Model_AdLink::getByCode('store');
                            ?>
                            <div onmouseover="setShare('<?= $ad->getTitle('') ?>', '<?= $ad->getAdUrl($this->user->id) ?>','<?= $ad->getContent('') ?>','<?= $this->cdn. $store->imageFile; ?>');"> 
                                <!--自定义第一个分享标题和链接-->
                                <!-- JiaThis Button BEGIN -->
                                <div class="jiathis_style">       
                                <a href="http://www.jiathis.com/share/?uid=1334580904971198" class="jiathis" target="_blank">
                                    <img src="http://v2.jiathis.com/code_mini/images/btn/v1/jiathis3.gif" border="0" />
                                </a>
                                </div>
                                <!-- JiaThis Button END -->
                            </div>
                        </td>
                    </tr>
                    <?php }?>
                </table>
            </div>
            <div class="operating">
            	<label><input name="" class="myall" type="checkbox" value="" />全选</label>
                <?php
                if($this->stores['size']>1){
                 echo $this->partial('paging.phtml',array("pages"=>$this->stores));
                }
                ?>
            </div>
            
            <div <?php if(empty($this->storelist))  echo "style='display: none'"; ?>>
                <div class="count"  >
                    <p><span>您的物品总重量：</span><em><?= round($this->selected['weight']) ?></em><span>g</span></p>
                </div>
                <div class="submit" >
                    <dl>
                            <dt>入库商品均保留自身包装，下一步申请去掉非必要包装可节省国际物流费用！</dt>
                        <dd><input name="" id="btnsubmit" type="submit" value="提交运送所选物品" onmouseover="this.className='by'" onmouseout="this.className=''" /></dd>

                    </dl>
                </div>
            </div>
            
        </div>
    </div>
</div>

<div class="houtai_overlay" style="display:none;"></div>
<!--单页面使用多分享按钮需要增加的分享参数代码-->                        
<script type="text/javascript">
function setShare(title, url,content,pic) {
    jiathis_config.title = title;
    jiathis_config.url = url;
    if(content){
      jiathis_config.summary = content;
    }
     if(pic){
      jiathis_config.pic = pic;
    }
}
  var jiathis_config = {}
  
  $("#receiveUser").mousemove(function(){
      $(".jianj").show();
  });
  $(".jianj").mouseout(function(){
     $(".jianj").hide(); 
  });
  
</script>   
<!--分享参数代码结束-->
<!--分享功能代码统一放到页尾-->
<script type="text/javascript" src="http://v1.jiathis.com/code/jia.js?uid=1334580904971198" charset="utf-8"></script>
<!--分享功能代码结束-->